#ifndef __SN32F288_CW2017_H
#define __SN32F288_CW2017_H


/*_____ I N C L U D E S ____________________________________________________*/
#include <SN32F280.h>
#include <SN32F200_Def.h>

/*_____ D E F I N I T I O N S ______________________________________________*/
#define		CW2017_ADDR			0xA2
/*_____ M A C R O S ________________________________________________________*/


/*_____ D E C L A R A T I O N S ____________________________________________*/
#define REG_VERSION             0x00
#define REG_VCELL_H             0x02
#define REG_VCELL_L             0x03
#define REG_SOC_INT             0x04
#define REG_SOC_DECIMAL         0x05
#define REG_TEMP                0x06
#define REG_MODE_CONFIG         0x08
#define REG_GPIO_CONFIG         0x0A
#define REG_SOC_ALERT           0x0B
#define REG_TEMP_MAX            0x0C
#define REG_TEMP_MIN            0x0D
#define REG_VOLT_ID_H           0x0E
#define REG_VOLT_ID_L           0x0F

#define REG_BATINFO             0x10

#define MODE_SLEEP              0x30
#define MODE_NORMAL             0x00
#define MODE_DEFAULT            0xF0
#define CONFIG_UPDATE_FLG       0x80

#define GPIO_CONFIG_MIN_TEMP             (0x00 << 4)
#define GPIO_CONFIG_MAX_TEMP             (0x00 << 5)
#define GPIO_CONFIG_SOC_CHANGE           (0x00 << 6)
#define GPIO_CONFIG_MIN_TEMP_MARK        (0x01 << 4)
#define GPIO_CONFIG_MAX_TEMP_MARK        (0x01 << 5)
#define GPIO_CONFIG_SOC_CHANGE_MARK      (0x01 << 6)
#define ATHD                              0x0		 //0x7F
#define DEFINED_MAX_TEMP                 450          //0xAB
#define DEFINED_MIN_TEMP                 0            //0x51



typedef struct tagSTRUCT_CW_BATTERY {
	/*IC value*/
	unsigned int version;
    unsigned int voltage;	
    unsigned int capacity;
	int temp;
	/*IC config*/
	unsigned char int_config;
	unsigned char soc_alert;
	uint16_t temp_max;
	uint16_t temp_min;
	/*Get before profile write*/ 
	unsigned int volt_id;
	
	/*Get from charger power supply*/
	unsigned int charger_mode;
	
	/*Mark for change cw_bat power_supply*/
	//unsigned int change;
}STRUCT_CW_BATTERY;
extern STRUCT_CW_BATTERY   cw_bat;

unsigned int cw_update_data(void);
unsigned char cw_bat_init(void);

#endif	/*__SN32F288_CW2017_H*/
